# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.APIKeys.V2.Model.V2ApiTarget do
  @moduledoc """
  A restriction for a specific service and optionally one or multiple specific methods. Both fields are case insensitive.

  ## Attributes

  *   `methods` (*type:* `list(String.t)`, *default:* `nil`) - Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples: `google.cloud.translate.v2.TranslateService.GetSupportedLanguage` `TranslateText` `Get*` `translate.googleapis.com.Get*`
  *   `service` (*type:* `String.t`, *default:* `nil`) - The service for this restriction. It should be the canonical service name, for example: `translate.googleapis.com`. You can use [`gcloud services list`](https://cloud.google.com/sdk/gcloud/reference/services/list) to get a list of services that are enabled in the project.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :methods => list(String.t()) | nil,
          :service => String.t() | nil
        }

  field(:methods, type: :list)
  field(:service)
end

defimpl Poison.Decoder, for: GoogleApi.APIKeys.V2.Model.V2ApiTarget do
  def decode(value, options) do
    GoogleApi.APIKeys.V2.Model.V2ApiTarget.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.APIKeys.V2.Model.V2ApiTarget do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
